# selection.Selection.[Symbol.iterator]

- **Module:** selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/selection.ts#L436
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-selection-[symbol-iterator]/

```
[Symbol.iterator](): IterableIterator<Model>
```

Iterate in tmux's own order.

Each call returns a fresh iterator, so a selection can be walked more than
once: spread it and then loop it, and the second pass is not empty. This is
what `for...of`, spread and destructuring all go through.

## Examples

```ts
for (const window of snapshot.windows) window.name;
[...snapshot.windows].length === snapshot.windows.length;
```

## Type parameters

- [`Model`](/en/ts/latest/reference/selection-selection/#selection.Selection.type-parameter.Model), declared by [`Selection<Model>`](/en/ts/latest/reference/selection-selection/)
